'use strict';

const Controller = require('egg').Controller;

class HomeController extends Controller {
  async get() {
    const { ctx, service } = this;
    ctx.body = await service.todo.findOne(ctx.params);
  }

  async create() {
    const { ctx, service } = this;
    ctx.body = await service.todo.create(ctx.params);
  }

  async remove() {
    const { ctx, service } = this;
    ctx.body = await service.todo.remove(ctx.params);
  }

  async update() {
    const { ctx, service } = this;
    ctx.body = await service.todo.updateOne(ctx.params);
  }
}

module.exports = HomeController;
